<cfoutput>
	<cfif IsUserLoggedIn() and IsDefined("request.scholar") and request.scholar.Scholarship_ID gt 0>
	
		<cfscript>
			scholarshipGateway = new assets.calgrants.com.gateway.ScholarshipGateway();
			scholarship = scholarshipGateway.get(Scholarship_ID = GetAuthUser());
			base = new assets.calgrants.com.Base();
			classScheduleDeadlineEnrollment = DateAdd("ww", 2, scholarship.getEnrollment_Date());
			classScheduleDeadlineClaiming = DateAdd("ww", 2, scholarship.getClaim_Date());
			classScheduleDeadline = IIf(classScheduleDeadlineEnrollment gt classScheduleDeadlineClaiming, DE(classScheduleDeadlineEnrollment), DE(classScheduleDeadlineClaiming));
			institutionGateway = new assets.calgrants.com.gateway.InstitutionGateway();
			institution = institutionGateway.get(Institution_ID = scholarship.getInstitution1_ID());
			if (institution.getInstitution_ID() gt 0 and ListFind("Semester,Quarter", institution.getTerm_Type()) gt 0) {
				paymentScheduleGateway = new assets.calgrants.com.gateway.PaymentScheduleGateway();
				paymentSchedule = paymentScheduleGateway.query(Cohort = scholarship.getCohort(), Scholarship_Type = scholarship.getScholarship_Type(), Term_Type = institution.getTerm_Type());
				paymentGateway = new assets.calgrants.com.gateway.PaymentGateway();
				payments = paymentGateway.query(Scholarship_ID = scholarship.getScholarship_ID());
			}
		</cfscript>
		
		<div class="row">
			<div class="span12">
				<cfif IsDefined("paymentSchedule") and paymentSchedule.RecordCount gt 0>
					<h4>Payment Schedule</h4>
					<div style="margin-right: 20px;">
						<table id="paymentsTable" class="table table-hover table-bordered">
							<thead>
								<tr>
									<th>Term</th>
									<th>Required Documents</th>
									<th>Deadline</th>
									<th>Amount</th>
									<th>Status</th>
								</tr>
							</thead>
							<tbody>
								<cfloop query="paymentSchedule">
									<tr>
										<td>#Term#</td>
										<td>
											<cfif Verification_Type eq "Enrollment">
												Class schedule
											<cfelseif Verification_Type eq "Performance">
												Transcript
											</cfif>
										</td>
										<td>
											<cfif CurrentRow eq 1 and Verification_Type eq "Enrollment">
												#DateFormat(classScheduleDeadline, "m/d/yyyy")#
											<cfelse>
												#DateFormat(Verification_Soft_Deadline, "m/d/yyyy")#
											</cfif>
										</td>
										<td>#DollarFormat(Payment_Amount)#</td>
										<td>#base.getPaymentStatus(Scholarship_ID = scholarship.getScholarship_ID(), Payment_Schedule_ID = Payment_Schedule_ID)#</td>						
									</tr>
								</cfloop>
							</tbody>
						</table>
					</div>				
				<cfelse>
					<div class="alert alert-info notFound">No payments are scheduled at this time.  Be sure to send your class schedule or transcript as described below.</div>
				</cfif>
				<h4>Class Schedule Requirements</h4>	
				<div style="margin-right: 20px;">
					<p>Class schedule must be an official document from your college or university.  The class schedule must show that you are enrolled at least half-time at a 2-year public or a 4-year public or private, degree granting college or university.</p>
				</div>
				<cfif scholarship.getPBS() eq 1>
					<h4>Transcript Requirements</h4>
					<div style="margin-right: 20px;">
						<p>Transcripts must be an official document from your college or university.  The transcript must show the classes your attended and the number of units applicable to each class.</p>
					</div>
				</cfif>
				<h4>Send By Fax or Mail</h4>
				<p>Send the required documents by the deadline via fax or postal mail.</p>
				<table border="0" cellpadding="4" cellspacing="0">
					<tr valign="top">
						<td><strong>Fax:</strong>&nbsp;</td>
						<td>(213) 482-0814<br></td>
					</tr>
					<tr valign="top">
						<td><strong>Mail:</strong>&nbsp;<br></td>
						<td>
							Carmen Gomez<br>
							Cash for College Administrator<br>
							350 S. Bixel Street, Suite 200<br>
							Los Angeles, CA 90017<br>			
						</td>
					</tr>
				</table>
				<br>&nbsp;<br>
			</div>
		</div>
	<cfelse>
		<div class="row">
			<div class="span12">
				<div class="alert alert-info notFound">Scholarship not found</div>
			</div>
		</div>
	</cfif>
</cfoutput>

<!--- <cfscript>
	scholarshipGateway = new assets.calgrants.com.gateway.ScholarshipGateway();
	if (IsUserLoggedIn()) {
		scholarship = scholarshipGateway.get(Scholarship_ID = GetAuthUser());
	} else if (IsDefined("Claim_ID") and Len(Trim(Claim_ID)) gt 0) {
		qScholarship = scholarshipGateway.query(Claim_ID = Claim_ID);
		scholarship = scholarshipGateway.get(Scholarship_ID = qScholarship.Scholarship_ID);
	}
</cfscript>

<cfif IsDefined("scholarship") and IsNumeric(scholarship.getScholarship_ID())>

	
	
	<script type="text/javascript" language="javascript">
	<!--	
		var validate = function() {
			var errors = "";
			var valid = true;
			if (!valid) {
				alert(errors);
			}
			return valid;				
		}
		
		$(function() {
		})
	//-->
	</script>
	
	<cfif IsDefined("paymentSchedule") and paymentSchedule.RecordCount gt 0>
	
		<h3>Payment Schedule and Deadlines</h3>
		
		<div style="margin-bottom: 20px;">
	
			<table id="paymentsTable" class="table table-hover table-bordered">
				<thead>
					<tr>
						<th>Term</th>
						<th>Required Documents</th>
						<th>Deadline</th>
						<th>Amount</th>
						<th>Status</th>
					</tr>
				</thead>
				<tbody>
					<cfoutput query="paymentSchedule">
						<!--- <cfquery name="GetPayment" dbtype="query">
							select *
							from payments
							where Payment_Schedule_ID = <cfqueryparam cfsqltype="cf_sql_integer" value="#Payment_Schedule_ID#">
						</cfquery> --->
						<tr>
							<td>#Term#</td>
							<td>
								<cfif Verification_Type eq "Enrollment">
									Class schedule
								<cfelseif Verification_Type eq "Performance">
									Transcript
								</cfif>
							</td>
							<td>
								<cfif CurrentRow eq 1 and Verification_Type eq "Enrollment">
									#DateFormat(classScheduleDeadline, "m/d/yyyy")#
								<cfelse>
									#DateFormat(Verification_Soft_Deadline, "m/d/yyyy")#
								</cfif>
							</td>
							<td>#DollarFormat(Payment_Amount)#</td>
							<td>
								<!--- <cfif GetPayment.RecordCount eq 0>
									<cfif DateDiff("d", Now(), Verification_Soft_Deadline) lt 0>
										<cfif Verification_Type eq "Enrollment">
											Late, class schedule not received
										<cfelseif Verification_Type eq "Performance">
											Late, transcript not recieved
										</cfif>
									<cfelse>
										Future payment
									</cfif>
								<cfelseif GetPayment.Opt_Out eq 1>
									Disqualified or opted-out
								<cfelseif IsNumeric(GetPayment.Payment_Amount)>
									Paid on #DateFormat(GetPayment.Payment_Date, "m/d/yyyy")#
								<cfelseif IsDate(GetPayment.Payment_Submitted_Date)>
									Submitted on #DateFormat(GetPayment.Payment_Submitted_Date, "m/d/yyyy")#
								<cfelseif IsDate(GetPayment.Approval_Date)>
									Approved on #DateFormat(GetPayment.Approval_Date, "m/d/yyyy")#
								<cfelse>
									<cfif IsDate(GetPayment.Institution1_Document_Date)>
										<cfif Verification_Type eq "Enrollment">
											Class schedule received
										<cfelseif Verification_Type eq "Performance">
											Transcript recieved
										</cfif>
									<cfelseif DateDiff("d", Now(), Verification_Soft_Deadline) gt 0>
										<cfif Verification_Type eq "Enrollment">
											Late, class schedule not received
										<cfelseif Verification_Type eq "Performance">
											Late, transcript not recieved
										</cfif>
									<cfelse>
										<cfif Verification_Type eq "Enrollment">
											Class schedule not received
										<cfelseif Verification_Type eq "Performance">
											Transcript not recieved
										</cfif>
									</cfif>
								</cfif> --->
								#base.getPaymentStatus(Scholarship_ID = scholarship.getScholarship_ID(), Payment_Schedule_ID = Payment_Schedule_ID)#
								<!--- #ListFirst(Payment_Status, ";")# --->
							</td>						
						</tr>
					</cfoutput>
				</tbody>
			</table>
		
		</div>
		
		<h3>Class Schedule Requirements</h3>
				
		<div style="margin-bottom: 20px;">
		
			<p>Class schedule must be an official document from your college or university.  The class schedule must show that you are enrolled at least half-time at a 2-year public or a 4-year public or private, degree granting college or university.</p>
			
		</div>
		
		<!--- <h3>Transcript Requirements</h3>
				
		<div style="margin-bottom: 20px;">
			
			<p>Class schedule must be an official document from your college or university.  The class schedule must show that you are enrolled in at least half-time (6 units) at a 2-year public or a 4-year public or private, degree granting college or university.</p>
			
		</div> --->
		
		<h3>Send By Fax or Mail</h3>
		
		<p>Send the required documents by the deadline via fax or postal mail.</p>
		
		<table border="0" cellpadding="4" cellspacing="0">
			<tr valign="top">
				<td><strong>Fax:</strong>&nbsp;</td>
				<td>(213) 482-0814<br></td>
			</tr>
			<tr valign="top">
				<td><strong>Mail:</strong>&nbsp;<br></td>
				<td>
					Carmen Gomez<br>
					Cash for College Administrator<br>
					350 S. Bixel Street, Suite 200<br>
					Los Angeles, CA 90017<br>			
				</td>
			</tr>
		</table>
		
	<cfelse>
		<div class="alert alert-info notFound">No scheduled payments</div>
	</cfif>

<cfelse>
	<div class="alert alert-info notFound">Scholarship not found</div>
</cfif> --->